﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace RouteValidator
{
    public partial class Form1 : Form
    {
        ValidationReport reportForm = new ValidationReport();
        static public Form1 mainForm = null;

        public string XmlPath = null;
        public string SqlPath = null;


        public Form1()
        {
            InitializeComponent();
        }

        private void butXml_Click(object sender, EventArgs e)
        {
            openXmlDialog.ShowDialog();
        }

        private void butSql_Click(object sender, EventArgs e)
        {
            openSqlDialog.ShowDialog();
        }

        private void openXmlDialog_FileOk(object sender, CancelEventArgs e)
        {
            txtXml.Text = XmlPath = openXmlDialog.FileName;
        }
        
        private void openSqlDialog_FileOk(object sender, CancelEventArgs e)
        {
            txtSql.Text = SqlPath = openSqlDialog.FileName;
        }

        private void butCommit_Click(object sender, EventArgs e)
        {

            if (File.Exists(txtSql.Text) && File.Exists(txtXml.Text))
            {
                mainForm = this;
                this.Hide();
                reportForm = new ValidationReport();
                reportForm.Show();
            }
            else
            {
                MessageBox.Show("Invalid file path(s)");
            }


        }



    }
}
